using System;

namespace octalforty.Componento.ComponentModel.Packaging
{
    public interface IPackageRepositoryBrowserProviderService
    {
        IRepositoryBrowser GetPackageRepositoryBrowser(Uri uri);
    }

    class PackageRepositoryBrowserProviderService : IPackageRepositoryBrowserProviderService
    {
        private Core.IServiceProvider serviceProvider;

        public PackageRepositoryBrowserProviderService(Core.IServiceProvider serviceProvider)
        {
            this.serviceProvider = serviceProvider;
        }

        public IRepositoryBrowser GetPackageRepositoryBrowser(Uri uri)
        {
            if(uri.Scheme == "file")
                return new LocalFileSystemPackageRepositoryBrowser(serviceProvider);

            if(uri.Scheme == "http")
                return new HttpRepositoryBrowser();

            return null;
        }
    }
}
